				<div class="section">
                	<script type="text/javascript">
					$(document).ready(function(){
						var $obj 	= $("#selectship");
						var $show 	= $("#room_show");
						var $ship   = $("#show_ship");
						var $ship_name = $("#ship_name");
						$obj.change(function(){
							$val = $(this).val();
							if($val == 0){
								alert("Please select a cruise!");
							}else{
								$.ajax({
									"url" 	: "<?php echo base_url(); ?>admin/checkrate/getrooms",
									"type"  : "post",
									"data"  : "val="+$val,
									"async" : false,
									success : function(result){
										$ship.html(result);
									}
								});
							}
						});
					});
					function show_box(){
						document.getElementById("box").style.display = "block";
						document.getElementById("ratet").attributes
					}
					function hide_box(){
						document.getElementById("box").style.display = "none";
					}
					function showch(){
						document.getElementById("charter").style.display = "block";
					}
					function hidech(){
						document.getElementById("charter").style.display = "none";
					}
					</script>
					<!--[if !IE]>start title wrapper<![endif]-->
					<div class="title_wrapper">
						<span class="title_wrapper_top"></span>
						<div class="title_wrapper_inner">
							<span class="title_wrapper_middle"></span>
							<div class="title_wrapper_content">
								<h2 class="menu_title">Edit price</h2>
							</div>
						</div>
						<span class="title_wrapper_bottom"></span>
					</div>
					<!--[if !IE]>end title wrapper<![endif]-->
					
					<!--[if !IE]>start section content<![endif]-->
					<div class="section_content">
						<span class="section_content_top"></span>
						
						<div class="section_content_inner">
                        	<div class="table_tabs_menu">
							<!--[if !IE]>start  tabs<![endif]-->
							<!--[if !IE]>end  tabs<![endif]-->

							</div>
				<!--[if !IE]>start table_wrapper<![endif]-->
							<div class="table_wrapper" style="background:none;">
								<div class="table_wrapper_inner">
                                	<form method="post" enctype="multipart/form-data">  
                                	<table width="612" border="0">
                                          <tr>
                                            <td width="250">Select cruise<select name="selectship" id="selectship">
                                            <option value="0">Please select</option>
                                            <?php
                                            foreach($listship as $items){
                                                echo "<option value='".$items['cruise_id']."'>".$items['cruise_name']."</option>";
                                            }
                                            ?>
                                        </select></td>
                                            <td width="240">
                                            	<div id="show_ship">
                                                	Select cabin<select id="cabinid" name="cabinid">
                                                    	<option value="0">Please select</option>
                                                    </select>
                                                </div>
                                            </td>
                                          </tr>
                                        </table>
                                        <!--<table width="332" border="0" style="margin-bottom:5px">
                                          <tr>
                                            <td width="84"><span style="color:#F00">Rate type</span></td>
                                            <td width="95">
                                            	<input type="radio" id="ratef" value="1" checked="checked" onclick="hidech(),show_box()" />Cabins
                                            </td>
                                            <td width="139"><input type="radio" id="ratet" value="1" onclick="hide_box(),showch()" />
                                            Charter</td>
                                          </tr>
                                        </table>-->
                               
                                    
                                        <fieldset>
                                        <legend>One night</legend>
                                        <a href="javascript:void(0);" onClick="AddRow('onenight');">Add row</a>
                                        <table id="onenight">
                                        <tr><td style="width:65px; text-align:center;">From date</td>
                                        <td style="width:65px; text-align:center;">To date</td>
                                        <td style="width:65px; text-align:center;">Rack rate</td>
                                        <td style="width:65px; text-align:center;">Single</td>
                                        <td style="width:65px; text-align:center;">Double</td>
                                        <td style="width:65px; text-align:center;">Twin</td>
                                        <td style="width:65px; text-align:center;">Child</td>
                                        <td style="width:65px; text-align:center;">Infant</td>
                                        <td style="width:65px; text-align:center;">Number room</td><td></td></tr>
                                        <tr>
                                        <td><input required style="width:65px; text-align:center" class="date" name="onenight[fromdate][]"></td>
                                        <td><input required style="width:65px; text-align:center" class="date" name="onenight[todate][]"></td>
                                        <td><input required style="width:65px; text-align:center" name="onenight[priceold][]"></td>
                                        <td><input required style="width:65px; text-align:center" name="onenight[pricesingle][]"></td>
                                        <td><input required style="width:65px; text-align:center" name="onenight[pricedouble][]"></td>
                                        <td><input required style="width:65px; text-align:center" name="onenight[pricetwin][]"></td>
                                        <td><input required style="width:65px; text-align:center" name="onenight[pricechild][]"></td>
                                        <td><input required style="width:65px; text-align:center" name="onenight[priceinfant][]"></td>
                                        <td><input required style="width:65px; text-align:center" name="onenight[numberavai][]"></td>
                                        <td><a href="javascript:void(0);" onClick="RemoveRow(this);">Remove</a></td>
                                        </tr>
                                        </table>
                                        </fieldset>
                                        <fieldset>
                                        <legend>Two night</legend>
                                        <a href="javascript:void(0);" onClick="AddRow('twonight');">Add row</a>
                                        <table id="twonight">
                                        <tr><td style="width:65px; text-align:center;">From date</td>
                                        <td style="width:65px; text-align:center;">To date</td>
                                        <td style="width:65px; text-align:center;">Rack rate</td>
                                        <td style="width:65px; text-align:center;">Single</td>
                                        <td style="width:65px; text-align:center;">Double</td>
                                        <td style="width:65px; text-align:center;">Twin</td>
                                        <td style="width:65px; text-align:center;">Child</td>
                                        <td style="width:65px; text-align:center;">Infant</td>
                                        <td style="width:65px; text-align:center;">Number room</td><td></td></tr>
                                        <tr>
                                        <td><input required style="width:65px; text-align:center" class="date" name="twonight[fromdate][]"></td>
                                        <td><input required style="width:65px; text-align:center" class="date" name="twonight[todate][]"></td>
                                        <td><input required style="width:65px; text-align:center" name="twonight[priceold][]"></td>
                                        <td><input required style="width:65px; text-align:center" name="twonight[pricesingle][]"></td>
                                        <td><input required style="width:65px; text-align:center" name="twonight[pricedouble][]"></td>
                                        <td><input required style="width:65px; text-align:center" name="twonight[pricetwin][]"></td>
                                        <td><input required style="width:65px; text-align:center" name="twonight[pricechild][]"></td>
                                        <td><input required style="width:65px; text-align:center" name="twonight[priceinfant][]"></td>
                                        <td><input required style="width:65px; text-align:center" name="twonight[numberavai][]"></td>
                                        <td><a href="javascript:void(0);" onClick="RemoveRow(this);">Remove</a></td>
                                        </tr>
                                        </table>
                                        </fieldset>
                                        <fieldset>
                                        <legend>Charter</legend>
                                        <a href="javascript:void(0);" onClick="AddRow('charter');">Add row</a>
                                        <table id="charter">
                                        <tr><td style="width:65px; text-align:center;">From date</td>
                                        <td style="width:65px; text-align:center;">To date</td>
                                        <td style="width:65px; text-align:center;">Rack rate</td>
                                        <td style="width:65px; text-align:center;">One person</td>
                                        <td style="width:65px; text-align:center;">Two people</td>
                                        <td style="width:65px; text-align:center;">Extra person</td>
                                        <td style="width:65px; text-align:center;">Number night</td>
                                        <td style="width:65px; text-align:center;">Number room to sell</td><td></td></tr>
                                        </table>
                                        </fieldset>
                                        <div style="text-align:center"><input type="submit" name="ok" value="Update" /></div>
                                        </form>
                                       
                                        <script type="text/javascript">
											$(document).ready(function(){
												$("#ok").click(function(){
													$start = $("#startdate").val();
													$endda = $("#endate").val();
													$reckrate = $("#rackrate").val();
													$oneper = $("#oneper").val();
													$twoper = $("#twoper").val();
													$extra = $("#extra").val();
													$numrom = $("#numroom").val();
													$cabin = $("#cabinid").val();
													if($cabin == 0){
														alert("Please select cabin");
														$("#cabinid").css("border","1px solid #F00");
														return false;
													}else{
														if($start == "" || $endda == "" || $oneper == "" || $numrom == ""){
															alert("Please enter full info");
															$("#startdate").focus();
															return false;
														}else{
															$.ajax({
																"url" 	: "<?php echo base_url(); ?>admin/checkrate/charter",
																"type" 	: "post",
																"data" 	: "start="+$start+"&end="+$endda+"&rackrate="+$reckrate+"&oneper="+$oneper+"&twoper="+$twoper+"&extra="+$extra+"&numroom="+$numrom+"&cabinid="+$cabin,
																"async" : false,
																success : function(result){
																	alert(result);
																}
															});
														}
													}
												});
											});
										</script>
                                        
                                        </div>
                                        <script>
                                        function AddRow(idtable){
											if(idtable!='charter'){
                                            	$("#"+idtable+" tr:last").after('<tr><td><input required class="date" style="width:65px; text-align:center" name="'+idtable+'[fromdate][]"></td><td><input required class="date" style="width:65px; text-align:center" name="'+idtable+'[todate][]"></td><td><input required style="width:65px; text-align:center" name="'+idtable+'[priceold][]"></td><td><input required style="width:65px; text-align:center" name="'+idtable+'[pricesingle][]"></td><td><input required style="width:65px; text-align:center" name="'+idtable+'[pricedouble][]"></td><td><input required style="width:65px; text-align:center" name="'+idtable+'[pricetwin][]"></td><td><input required style="width:65px; text-align:center" name="'+idtable+'[pricechild][]"></td><td><input required style="width:65px; text-align:center" name="'+idtable+'[priceinfant][]"></td><td><input required style="width:65px; text-align:center" name="'+idtable+'[numberavai][]"></td><td><a href="javascript:void(0);" onClick="RemoveRow(this);">Remove</a></td></tr>');
											}else{
												$("#"+idtable+" tr:last").after('<tr><td><input required style="width:65px; text-align:center" class="date" name="'+idtable+'[fromdate][]"></td><td><input required style="width:65px; text-align:center" class="date" name="'+idtable+'[todate][]"></td><td><input required style="width:65px; text-align:center" name="'+idtable+'[priceold][]"></td><td><input required style="width:65px; text-align:center" name="'+idtable+'[pricesingle][]"></td><td><input required style="width:65px; text-align:center" name="'+idtable+'[pricedouble][]"></td><td><input required style="width:65px; text-align:center" name="'+idtable+'[pricetwin][]"></td><td><input required style="width:65px; text-align:center" name="'+idtable+'[numbernight][]"></td><td><input required style="width:65px; text-align:center" name="'+idtable+'[numberavai][]"></td><td><a href="javascript:void(0);" onClick="RemoveRow(this);">Remove</a></td></tr>');
											}
                                            $(".date").datepicker({
                                                  changeMonth: true,
                                                  changeYear: true,
                                                  dateFormat:"yy-mm-dd"
                                                });
                                        }
                                        function RemoveRow(aelement){
                                            $(aelement).parent().parent().remove();
                                        }
                                        $(document).ready(function(e) {
                                            $( ".date" ).datepicker({
                                                  changeMonth: true,
                                                  changeYear: true,
                                                  dateFormat:"yy-mm-dd"
                                                });
                                        });
                                        </script>
                                </div>
							</div>
							<!--[if !IE]>end table_wrapper<![endif]-->
						</div>
						<span class="section_content_bottom"></span>
					</div>
					<!--[if !IE]>end section content<![endif]-->
				</div>